import { RMIObject } from "../../Engine/RMI/RMIObject";
import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SLoginReturn } from "./SLoginReturn";
import { SeqMyRoleHelper } from "./SeqMyRoleHelper";
import { Exception } from "../../Framework/Util/Exception";
//class AMI_ILogin_login

export class AMI_ILogin_login extends RMIObject {
  constructor(arg1: Function, arg2: Function, _userObj?: Object) {
    super(arg1, arg2);
    this.userObject = _userObj;
    this.callFunction = "login";
    return;
  }

  public /* override */ __response(stream: SerializeStream): void {
    try {
      var sReturn = new SLoginReturn();
      sReturn.__read(stream);
      var myRoles = SeqMyRoleHelper.read(stream);
    } catch (__ex) {
      this.cdeException(
        new Exception(
          "ExceptionCodeSerialize",
          Exception.ExceptionCodeSerialize
        )
      );
      return;
    }
    this.cdeResponse(sReturn, myRoles);
  }

  public cdeResponse(arg1: SLoginReturn, arg2: Array<any>): void {
    if (null != this._response) {
      this._response.call(null, this, arg1, arg2);
    }
  }
}
